<?php
namespace api\common\controllers;

use api\common\behaviors\ValidateBehavior;
use yii\filters\Cors;
use yii\helpers\ArrayHelper;
use yii\filters\auth\QueryParamAuth;

class AController extends \yii\rest\ActiveController
{
    /**
     * 配置让dataProvider返回items
     * @var array
     */
    public $serializer = [
        'class' => 'yii\rest\Serializer',
        'collectionEnvelope' => 'items'
            ];


    public function actions()  
    {  
        $actions = parent::actions();  
        // 注销系统自带的实现方法  
        unset($actions['index'], $actions['update'], $actions['create'], $actions['delete'], $actions['view']);  
        return $actions;  
    }  

    public function behaviors() {
        return ArrayHelper::merge (parent::behaviors(), [ 
                'authenticator' => [ 
                    'class' => QueryParamAuth::className() 
                ] 
            ] );
    }
}
